#include <stdio.h>
int main ()
    
{
    int n = 0;
    int arr[50] = {0};
    int arr1[50] = {0};
    int num = 0;
    int i = 0;
    int j = 0;
    int count = 0;
    
    
    scanf ("%d",&n);
    for(i=0;i < n;i++)
    {
        scanf ("%d",&arr[i]);
    }
    scanf ("%d",&num);
    
    for(i = 0; i < n ; i++)
    {
        if (num > arr[i])
        {
            count ++;
        }
    }
    arr1[count]=num;
    for(i = 0;i<n+1;i++)
    {
        if(j == count)
        {
            j++;
        }
        arr1[j] = arr[i];
        j++;
    }
    for(i = 0;i<n+1;i++)
    {
        printf ("%d ",arr1[i]);
    }
    return 0;
}